/*
 * Filename TestOrderRepositoryImpl.java 2022年03月10日
 * Copyright © Ehome Co.Ltd. All Rgiths Reserved.
 * @author wuyingchao
 */
package com.ehome.poct.core.dao.mybatis;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ehome.mybatisplus.support.AbstractCrudRepository;
import com.ehome.poct.core.api.dto.check.CheckStatusDTO;
import com.ehome.poct.core.api.dto.order.TestOrderDTO;
import com.ehome.poct.core.dao.entity.order.TestOrderDO;
import com.ehome.poct.core.dao.mybatis.mapper.order.TestOrderMapper;
import com.ehome.poct.core.repository.order.TestOrderRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

/**
 * @author wyc
 * @since 2022/03/10 14:06
 **/
@Repository
@AllArgsConstructor
public class TestOrderRepositoryImpl extends AbstractCrudRepository<TestOrderDO, TestOrderDTO> implements TestOrderRepository  {
    private final TestOrderMapper orderMapper;

    @Override
    public int delByOrderNo(String orderNo) {
        return orderMapper.delete(Wrappers.<TestOrderDO>lambdaQuery().eq(TestOrderDO::getTestOrderNo, orderNo));
    }

    @Override
    public void updateByOrderNo(CheckStatusDTO checkStatusDTO) {
        orderMapper.update(null,Wrappers.<TestOrderDO>lambdaUpdate().set(TestOrderDO::getStatus,checkStatusDTO.getStatus()).eq(TestOrderDO::getTestOrderNo,checkStatusDTO.getOrderNo()));
    }
}